<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${cPath }/se2/js/HuskyEZCreator.js" charset="utf-8"></script>
<title>Insert title here</title>
<script type="text/javascript">
<!--
<c:if test="${!empty msg }">
alert("${msg }");
</c:if>

	function validate_check() {
		submitContents(document.budForm);
		if(document.budForm.bo_title.value == "") {
			alert('제목을 입력하세요.');
			document.budForm.bo_title.focus();
		} else if(document.budForm.bo_writer.value == "") {
			alert('작성자를 입력하세요.');
			document.budForm.bo_writer.focus();
		} else if(document.budForm.bo_pass.value == "") {
			alert('비밀번호를 입력하세요.');
			document.budForm.bo_pass.focus();
		} else if(document.getElementById("ir1").value == "<br>") {
			alert('내용을 입력하세요.');
			document.budForm.bo_content.focus();
		} else {
			document.budForm.submit();
		}
	}
//-->
</script>
</head>
<body>
<div id="imgt3">
	<img src="${cPath }/css/b3.png" width="35%" align="left"><br>
	<br><br><br><br>
	</div>
<form action="${cPath }/boardbudInsert.do" 
	method="post" enctype="multipart/form-data" name="budForm"
	onsubmit="">
<div align="center" id="boardForm3">
<table>
	<tr>
		<th>제목</th>
		<td>
			<INPUT type="text" id="text" name="bo_title"/>
		</td>
	</tr>
	<tr>
		<th>작성자</th>
		<td>
			<INPUT type="text" id="text" name="bo_writer"/>
		</td>
	</tr>
	<tr>
		<th>비밀번호</th>
		<td>
			<INPUT type="password" id="text" name="bo_pass"/>
		</td>
	</tr>
	<tr>
		<th>내용</th>
		<td>
			<TEXTAREA id="ir1" rows="5" cols="40" name="bo_content"></TEXTAREA>
		</td>
	</tr>
	
</table><br><br>
			<input type="button" value="등록하기" onclick="validate_check();" />
			<input type="button" value="목록가기" onclick="window.location.href='${cPath}/boardbudList.do'"/>
		
</div>
<SCRIPT type="text/javascript">
var oEditors = [];
nhn.husky.EZCreator.createInIFrame({
    oAppRef: oEditors,
    elPlaceHolder: "ir1",
    sSkinURI: "${cPath}/se2/SmartEditor2Skin.html",
    fCreator: "createSEditor2"
});

function submitContents(elClickedObj) {
	   // 에디터의 내용이 textarea에 적용된다.
	   oEditors[0].exec("UPDATE_CONTENTS_FIELD", []);
	 
	   // 에디터에 입력된 내용의 검증은 이곳에서
	   // document.getElementById("ir1").value 값을 이용해서 처리한다.
	 
	   try{
	       // 이 라인은 현재 사용 중인 폼에 따라 달라질 수 있다.
// 	       elClickedObj.submit();
	   }catch(e){}
	}

</SCRIPT>
</form>
</body>
</html>